package cn.iocoder.yudao.module.biz.dal.mysql.zmdeduction;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.biz.dal.dataobject.zmdeduction.ZmDeductionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.biz.controller.admin.zmdeduction.vo.*;

/**
 * 扣款报 Mapper
 *
 * @author 支付免押
 */
@Mapper
public interface ZmDeductionMapper extends BaseMapperX<ZmDeductionDO> {

    default PageResult<ZmDeductionDO> selectPage(ZmDeductionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ZmDeductionDO>()
                .eqIfPresent(ZmDeductionDO::getSubCommpany, reqVO.getSubCommpany())
                .eqIfPresent(ZmDeductionDO::getServiceId, reqVO.getServiceId())
                .eqIfPresent(ZmDeductionDO::getOrderNo, reqVO.getOrderNo())
                .eqIfPresent(ZmDeductionDO::getBizCode, reqVO.getBizCode())
                .eqIfPresent(ZmDeductionDO::getBizStreamCode, reqVO.getBizStreamCode())
                .likeIfPresent(ZmDeductionDO::getUserName, reqVO.getUserName())
                .eqIfPresent(ZmDeductionDO::getTradeType, reqVO.getTradeType())
                .eqIfPresent(ZmDeductionDO::getTradeAmt, reqVO.getTradeAmt())
                .eqIfPresent(ZmDeductionDO::getSqAmt, reqVO.getSqAmt())
                .eqIfPresent(ZmDeductionDO::getTradeOrderNo, reqVO.getTradeOrderNo())
                .betweenIfPresent(ZmDeductionDO::getOrderTime, reqVO.getOrderTime())
                .betweenIfPresent(ZmDeductionDO::getDeductionTime, reqVO.getDeductionTime())
                .betweenIfPresent(ZmDeductionDO::getDeductionSuccTime, reqVO.getDeductionSuccTime())
                .eqIfPresent(ZmDeductionDO::getOrderStatus, reqVO.getOrderStatus())
                .eqIfPresent(ZmDeductionDO::getDeductionFailMemo, reqVO.getDeductionFailMemo())
                .betweenIfPresent(ZmDeductionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ZmDeductionDO::getId));
    }

}